﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Business;

public partial class FullReport : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        String clientID = Request.QueryString["clienID"];
        String selectedDate = Request.QueryString["d"];
        String reportcontent = this.Controls.ToString();
        string strBody = "<html>" +
           "<body>";

        CreateConn objcon = new CreateConn();
        string query_site = "select siteName from Sites s, Clients c where c.client_id = s.client_id and c.client_id='" + clientID + "'";
        DataTable dt_sites = objcon.SQLConnDataTable(query_site);

        foreach (DataRow dr in dt_sites.Rows) {
            strBody += dr["siteName"].ToString();

        }

        strBody += "</body>" + "</html>";

        string fileName = "MsWordSample.doc";
        // You can add whatever you want to add as the HTML and it will be generated as Ms Word docs
        Response.AppendHeader("Content-Type", "application/msword");
        Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName);
        Response.Write(strBody);
    }
}